﻿Imports extranet.BE
Imports extranet.DA

Public Class BCVaga

  Public Shared Sub Cadastrar(ByVal objBEVaga As BEVaga)
    Dim objDAVaga As New DAVaga
    objDAVaga.Cadastra(objBEVaga)
  End Sub

  Public Shared Sub Atualizar(ByVal objBEVaga As BEVaga)
    Dim objDAVaga As New DAVaga
    objDAVaga.Atualiza(objBEVaga)
  End Sub

  Public Shared Sub RelacionaVagaProva(ByVal objBEVaga As BEVaga)
    Dim objDAVaga As New DAVaga
    objDAVaga.RelacionaVagaProva(objBEVaga)
  End Sub

  Public Shared Sub Excluir(ByVal objBEVaga As BEVaga)
    Dim objDAVaga As New DAVaga
    objDAVaga.Exclui(objBEVaga)
  End Sub

  Public Shared Function Selecionar(ByVal intIdVaga As Integer) As List(Of BEVaga)
    Dim objDAVaga As New DAVaga()
    Dim objBEVagas As IList(Of BEVaga) = Nothing
    If intIdVaga > 0 Then objBEVagas = objDAVaga.Seleciona(New BEVaga(intIdVaga))
    Return objBEVagas
  End Function

  Public Shared Function Selecionar(ByVal strVaga As String, ByVal intArea As Integer, ByVal intAtivo As Integer, _
                                    ByVal sortExpression As String, ByVal sortDirection As String) As List(Of BEVaga)
    Dim objDAVaga As New DAVaga
    Dim objBEVaga As New BEVaga
    objDAVaga.objQuery.Sort = New BESort(sortExpression, sortDirection)
    objBEVaga.Codigo = strVaga
    objBEVaga.Titulo = strVaga
    objBEVaga.AreaVaga = intArea
    objBEVaga.Estado = intAtivo
    Return objDAVaga.Seleciona(objBEVaga)
  End Function

  Public Shared Sub AdicionarCandidato(ByVal intIdVaga As Integer, ByVal intIdCandidato As Integer)
    Dim objDAVaga As New DAVaga
    Dim objBEVaga As New BEVaga(intIdVaga)
    objBEVaga.Candidatos = New List(Of BECandidato)
    objBEVaga.Candidatos.Add(New BECandidato(intIdCandidato))
    objDAVaga.AdicionarCandidatos(objBEVaga)
  End Sub

  Public Shared Sub RemoverCandidato(ByVal intIdVaga As Integer, ByVal intIdCandidato As Integer)
    Dim objDAVaga As New DAVaga
    Dim objBEVaga As New BEVaga(intIdVaga)
    objBEVaga.Candidatos = New List(Of BECandidato)
    objBEVaga.Candidatos.Add(New BECandidato(intIdCandidato))
    objDAVaga.RemoverCandidatos(objBEVaga)
  End Sub

End Class